import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../../global/provider/favor_provider.dart';
import '../../../common/widgets/common_meal_list_cell.dart';
import '../../../../generated/l10n.dart';

class YSHFavorPageContent extends StatelessWidget {
  const YSHFavorPageContent({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Consumer<YSHFavorProvider>(
        builder: (consumerCtx, favorProvider, child) {
          if (favorProvider.favorList.isEmpty) {
            return Center(
                child: Text(S.of(context).favorPageNoDataTip)
            );
          }
          return ListView.builder(
              itemCount: favorProvider.favorList.length,
              itemBuilder: (_, index) {
                return YSHMealListCell(favorProvider.favorList[index]);
              });
        });
  }
}
